import 'package:flutter/material.dart';
import 'package:ldyxiangmu/bean/category_goods_bean.dart';
import '../bean/category_child_opt_bean.dart';

class ChildCategory with ChangeNotifier {
  List<CategoryChildBean> childCategoryList = [];
  List<CategoryGoodsBean> categoryGoodsList = [];
  int page = 1; //通过页面来判断是否是切换后的第一页,同时,可以通过page++来加载更多
  int optId = 305;
  int childIndex = 0; //右侧上方小导航的下标

  changeChildIndex(index) {
    childIndex = index;
    notifyListeners();
  }

  setChildCategory(list) {
    childCategoryList = list;
    notifyListeners();
  }

  setCategoryGoodsList(list) {
    categoryGoodsList = list;
    notifyListeners();
  }

  //增加page的方法
  addPage() {
    page++;
    notifyListeners();
  }

  //设置page归零
  rePage() {
    page = 1;
    notifyListeners();
  }

  addCategoryGoodsList(list) {
    categoryGoodsList.addAll(list);
    notifyListeners();
  }

  setOptId(optId) {
    this.optId = optId;
  }
}
